"""
@Time ： 2022/12/9 11:11
@Auth ： 陈杰 200320501042
@E-mail : 1612845322@qq.com
"""
from student.student import Student
from student.database import getsession


def query():
    session = getsession()
    rows = session.query(Student.sid, Student.sname, Student.sex,
                         Student.birthday, Student.specialty,
                         Student.ascores).all()
    # 对结果进行格式输出
    print("-" * 120)
    for row in rows:
        for i in range(len(row)):
            print(row[i], end="  ")
        print()
    session.close()


def deleteid(id):  # 根据编号删除数据
    session = getsession()
    session.query(Student).filter_by(sid=id).delete()
    session.commit()
    session.close()
    print("删除的学号为“" + id + "”学生信息成功！")

